<?php

/**
 * Kpiday form base class.
 *
 * @method Kpiday getObject() Returns the current form's model object
 *
 * @package    seth
 * @subpackage form
 * @author     Fuz
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseKpidayForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'         => new sfWidgetFormInputHidden(),
      'day'        => new sfWidgetFormDateTime(),
      'plant'      => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Plant'), 'add_empty' => false)),
      'subplant'   => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Subplant'), 'add_empty' => true)),
      'lastupdate' => new sfWidgetFormDateTime(),
      'pr'         => new sfWidgetFormInputText(),
      'rad'        => new sfWidgetFormInputText(),
      'expen'      => new sfWidgetFormInputText(),
      'impen'      => new sfWidgetFormInputText(),
      'tmod'       => new sfWidgetFormInputText(),
      'tenv'       => new sfWidgetFormInputText(),
    ));

    $this->setValidators(array(
      'id'         => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'day'        => new sfValidatorDateTime(),
      'plant'      => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Plant'))),
      'subplant'   => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Subplant'), 'required' => false)),
      'lastupdate' => new sfValidatorDateTime(),
      'pr'         => new sfValidatorNumber(array('required' => false)),
      'rad'        => new sfValidatorNumber(array('required' => false)),
      'expen'      => new sfValidatorNumber(array('required' => false)),
      'impen'      => new sfValidatorNumber(array('required' => false)),
      'tmod'       => new sfValidatorNumber(array('required' => false)),
      'tenv'       => new sfValidatorNumber(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('kpiday[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Kpiday';
  }

}
